/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


function calTime(){
    var currentETime = new Date();
    var eTime = currentETime.getTime();
    $('#responseTime').html(eTime - sTime);
}
var sTime;
function startTime(){
    var currentSTime = new Date();
    sTime = currentSTime.getTime();
    $('#responseTime').html("<img src=\"./images/loader.gif\" />");
}

 


function loadLimitTable(){
    
    startTime();
    $("#showTable").html("<img src=\"./images/loader.gif\" />");
    $("#showTable").load("LimitServlet?action=loadlimit").hide().fadeIn('slow');
    calTime();
  

}

jQuery(document).ready(function(){
    jQuery("#formID").validationEngine('attach', {
        onValidationComplete: function(form, status){
            if(status){

                 


                $.post(
                                "LimitServlet?action=addlimit",
                                $("#formID").serialize(),
                                function(data){
                                    if (data.success){
                                        alert("success to set alert limit ");
                                        loadLimitTable();
                                        $("#limit").val("");
                                        $("#limit2").val("");

                                    }
                                    else
                                        alert("Error can't insert data ");
                                },
                                "json"

                                );
                         
              
            }
        }
    });
});


function editLimit(limit,limit2){

    $("#limit").val(limit);
    $("#limit2").val(limit2);
    $("#limit").focus();

}

